﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace AMing.Mvc4.Web
{
    /// <summary>
    /// 主机名与返回的ActionResult
    /// </summary>
    public class HostNameActionResult
    {
        public HostNameActionResult(HostNameEnum key, ActionResult value)
        {
            this.Key = key;
            this.Value = value;
        }
        public HostNameActionResult(HostNameEnum key, Func<ActionResult> value)
        {
            this.Key = key;
            this.ActionResultFunc = value;
        }
        /// <summary>
        /// HostNameEnum
        /// </summary>
        public HostNameEnum Key { get; set; }

        public ActionResult _value = null;
        /// <summary>
        /// ActionResult
        /// </summary>
        public ActionResult Value
        {
            get
            {
                if (_value == null && ActionResultFunc != null)
                {
                    _value = ActionResultFunc();
                }
                return _value;
            }
            set
            {
                _value = value;
            }
        }
        /// <summary>
        /// ActionResult
        /// </summary>
        public Func<ActionResult> ActionResultFunc { get; set; }
    }
}
